package com.yuanqi.java.result;

import lombok.Getter;

/**
 * 退货单状态枚举
 */
@Getter
public enum ReturnOrderStatus {

    DRAFT(0, "草稿"),
    PENDING_AUDIT(1, "待审核"),
    APPROVED(2, "审核通过"),
    COMPLETED(3, "已完成");

    private final Integer code;
    private final String description;

    ReturnOrderStatus(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static ReturnOrderStatus getByCode(Integer code) {
        for (ReturnOrderStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}
